package com.yxh.view;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.yxh.R;

public class CommonDialog extends Dialog {
	
	public static final int NORAML = 0;
	public static final int NOTITLE = 1;
	private TextView title;
	private TextView content;
	private TextView ok;
	private TextView cancle;
	
	

	public CommonDialog(Context context, int style) {
		super(context, R.style.MyDialog);
		if(style == 0){
			setContentView(R.layout.view_common_dialog);
			content = (TextView) findViewById(R.id.content);
		}else{
			setContentView(R.layout.view_common_dialog_notitle);
		}
		title = (TextView) findViewById(R.id.title);
		cancle = (TextView) findViewById(R.id.cancle);
		ok = (TextView) findViewById(R.id.ok);
		ok.setTag(CommonDialog.this);
		cancle.setTag(CommonDialog.this);
	}

	public TextView getTitleLayout() {
		return title;
	}

	public TextView getcontentLayout() {
		return content;
	}

	public void setTitle(String t) {
		title.setText(t);
	}

	public void setContent(String c) {
		if(content != null)
		   content.setText(c);
	}

	public void setOkContent(String c) {
		ok.setText(c);
	}

	public void setCancleContent(String c) {
		cancle.setText(c);
	}

	public void setOkOnClick(View.OnClickListener listener) {
		ok.setOnClickListener(listener);
	}

	public void setCancleOnClick(View.OnClickListener listener) {
		cancle.setOnClickListener(listener);
	}

	public void setCancleGone() {
		cancle.setVisibility(View.GONE);
	}


}
